import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: () => import('@/views/layout/LayoutContainer.vue'),
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('@/views/home/HomeContainer.vue')
        },
        {
          path: '/search',
          name: 'search',
          component: () => import('@/views/search/searchContainer.vue')
        },
        {
          path: '/postsInfo',
          name: 'postsInfo',
          component: () => import('@/views/posts/PostsInfoContainer.vue')
        },
        {
          path: '/companyInfo',
          name: 'companyInfo',
          component: () => import('@/views/company/CompanyInfoContainer.vue'),
          children: [
            {
              path: '/companyPosts',
              name: 'companyPosts',
              component: () =>
                import('@/views/company/posts/CompanyPostsContainer.vue')
            }
          ]
        },
        {
          path: '/connect',
          name: 'connect',
          component: () => import('@/views/connect/ConnectContainer.vue')
        },
        {
          path: '/person',
          name: 'person',
          component: () => import('@/views/person/PersonContainer.vue')
        }
      ]
    },
    // 登录注册页面
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/LoginContainer.vue')
    },
    // 地图页面
    {
      path: '/map',
      name: 'map',
      component: () => import('@/views/map/MapContainer.vue')
    },
    // 发布职位初始化
    {
      path: '/RecruitmentInit',
      name: 'RecruitmentInit',
      component: () => import('@/views/recruitment/RecruitmentInit.vue')
    },
    // 创建公司
    {
      path: '/RecruitmentCompany',
      name: 'RecruitmentCompany',
      component: () => import('@/views/recruitment/RecruitmentCompany.vue')
    },
    // 通知页面
    {
      path: '/notic',
      name: 'notic',
      component: () => import('@/views/notic/NoticContainer.vue')
    }
  ]
})

export default router
